using System;
using ASPNETVN.PORTAL.Components.UI;
using ASPNETVN.PORTAL.Modules.LINK.Components;

namespace ASPNETVN.PORTAL.Modules.LINK
{
    public partial class Main : PortalModuleControl
    {       
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.ModuleTitle.AddUrl = string.Format("~/Modules/Link/EditLink.aspx?tabindex={0}&itemid={1}&mid={2}", this.TabIndex, 0, this.ModuleID);
                dlLinks.DataSource = Item.SelectAll(this.ModuleID);
                dlLinks.DataBind();
            }
        }

        protected string GetEditURL(int itemID, int moduleID)
        {
            return string.Format("~/Modules/Link/EditLink.aspx?tabindex={0}&itemid={1}&mid={2}", this.TabIndex, itemID, moduleID);
        }

        protected static string GetImageURL(string imageUrl)
        {
            if (imageUrl.Length == 0) return "";
            return "~/Modules/Link/Icons/" + imageUrl;
        }
    }
}